﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="OrderDetails.ascx.cs" Inherits="UserControls_OrderDetails" %>
<%@Import namespace="OrderServiceReference" %>
<%@Import namespace="ProductServiceReference" %>
<%@Import namespace="System.ServiceModel" %>
<% try
   {
       var client = new OrderServiceClient();
       var client2 = new ProductServiceClient();
       var orderid = int.Parse(Request.QueryString["orderid"]);
       var orderinfo = client.GetOrder(orderid);

       var productid = orderinfo.ProductID;
       var productinfo = client2.GetProduct(productid);
       %>
       <table>
        <tr>
            <td>Order id</td>
            <td><%= orderinfo.OrderID %></td>
        </tr>
         <tr>
             <td>
                Product name
             </td>
             <td>
                <%=productinfo.ProductName %> 
             </td>
        </tr>
         <tr>
            <td>Price</td>
            <td><%=productinfo.Price %></td>
        </tr>
        <tr>
            <td>Quantity</td>
            <td><%=orderinfo.Quantity %></td>
        </tr>
        <tr>
            <td>Total</td>
            <td><%=orderinfo.Total %></td>
        </tr>
        <tr>
            <td>Order date</td>
            <td><%=orderinfo.OrderDate %></td>
        </tr>
        <tr>
            <td>Order expiate</td>
            <td><%=orderinfo.OrderExp %></td>
        </tr>
        <tr>
            <td>Address</td>
            <td><%=orderinfo.NewAddress %></td>
        </tr>   
    </table>

       <%
   }
   catch (FaultException<Product> faultException)
   {
        %>
            <p>Khong co thong tin</p>
        <%
   }
   catch (FaultException<Order> faultException)
   {
       %>
            <p>Khong co thong tin</p>
        <%
   }
   catch (Exception)
   {
         %>
            <p>Khong co thong tin</p>
        <%
   }
  
   
%>
